home *** CD-ROM | disk | FTP | other *** search
- ;-------T-------T------------------------T---------------------------------;
- ;Open a screen using an external OBJect file.
- ;--------------------------------------------
- ;This demo will open a screen, based on the parameters in an external object
- ;file. This allows a VERY high level of external editing that will alter
- ;how this program behaves, without having to reassemble it.
- ;
- ;This feature is highly important as it allows up to 100% configurability of
- ;your game, which previously has only been available to applications using
- ;libraries such as MUI. However, it is even more powerful than this as
- ;graphic artists could not only create new datasets for your game, but also
- ;alter the dimensions, colours, resolution, attributes (and more) of your
- ;BOBs and screens. Support for code segments is also available, so
- ;external functions could be altered and improved by programmers. This will
- ;ensure that your game has a long lasting future as it keeps up with current
- ;technology and additions to GMS.
- ;
- ;I hope you make the most of external objects, its worth it!
-
- INCDIR "INCLUDES:"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i"
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- SECTION "ObjectTags",CODE
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- STARTGMS
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l GMSBase(pc),a6
- lea OBJName(pc),a0 ;a0 = Name of the object file.
- CALL LoadObjectFile ;>> = Go and load it.
- move.l d0,ObjectBase ;MA = Save the base.
- beq.s .Error_ObjectFile ;>> = Quit if error.
-
- move.l ObjectBase(pc),a0 ;a0 = Object Base.
- lea Objects(pc),a1 ;a1 = A list of objects to get.
- CALL GetObjectList ;>> = Get our objects.
- tst.l d0 ;d0 = Success?
- bne.s .Error_Screen ;>> = Quit if error.
-
- move.l Screen(pc),a0 ;a0 = GameScreen tags
- CALL AddScreen ;>> = Initialise the screen.
- tst.l d0 ;MA = Save pointer to the GameScreen.
- beq.s .Error_Screen ;>> = Quit if error.
-
- move.l Screen(pc),a0
- move.l Picture(pc),a1
- move.l GS_MemPtr1(a0),PIC_Data(a1)
- CALL LoadPic
- tst.l d0
- beq.s .Error_Picture
-
- move.l PIC_Palette(a1),GS_Palette(a0)
- CALL UpdatePalette
-
- CALL ShowScreen
-
- bsr.s Main
-
- .ReturnToDOS
- move.l GMSBase(pc),a6
- move.l Picture(pc),a1
- CALL FreePic
- .Error_Picture
- move.l Screen(pc),a0
- CALL DeleteScreen
- .Error_Screen
- move.l ObjectBase(pc),a0
- CALL FreeObjectFile
- .Error_ObjectFile
- MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #ERR_OK,d0
- rts
-
- ;===========================================================================;
- ; MAIN LOOP
- ;===========================================================================;
-
- Main: CALL WaitVBL
- moveq #JPORT1,d0
- CALL ReadMouse
- btst #MB_LMB,d0
- beq.s Main
- rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- ObjectBase: dc.l 0
- OBJName: dc.b "GMS:demos/data/OBJ.Screen",0
- even
-
- Objects dc.l OBJECTLIST,0
- dc.l TXT_Screen
- Screen: dc.l 0
- dc.l TXT_Picture
- Picture dc.l 0
- dc.l LISTEND
-
- TXT_Screen: dc.b "Screen",0
- even
- TXT_Picture: dc.b "Picture",0
- even
-
-